var messageController={
	init:function(){
        /**
         * 显示左面导航
         */
        showLeftStyle("message");
        messageController.initTable();

        //查询
        $("#search").click(function(){
            messageController.search();
        });
	},
    initTable:function(){
        /**
         * 表格
         */
        $('#dg').datagrid( {
            width: clientWidth-200,
            height: clientHeight-180,
            rownumbers : true,
            singleSelect : true,
            pagination : true,
            pageSize : 20,
            fitColumns: true,
            //nowrap:false,
            url : basePath+'/message/listPage',
        });
	},
	search:function(){
        var postData = {
            params : {}
        };
        var receiverName=$('#tb #content').val();
        if(receiverName){
            postData.params.receiverName = "%"+receiverName.trim()+"%";
        }
        $("#dg").datagrid("options").queryParams = postData;
        $("#dg").datagrid("reload");
	}
};
$(function(){
    messageController.init();
});

function  dateformater(value,row,index){
    return (new Date(value)).format("yyyy-MM-dd hh:mm:ss");
}

function  statusformater(value,row,index){
    if(value == '0') {
        value = '未查看';
    } else if(value == '1') {
        value = '已查看';
    }
    return value;
}

